import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/home/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '/home',
    component: Home,
    redirect: '/welcome',
    children: [
      { path: '/welcome', component: () => import('@/views/welcome.vue') },
      { path: '/users', component: () => import('@/views/user/index.vue') },
      { path: '/rights', component: () => import('@/views/power/rights.vue') },
      { path: '/roles', component: () => import('@/views/power/roles.vue') },
      {
        path: '/categories',
        component: () => import('@/views/goods/categories.vue')
      },
      { path: '/params', component: () => import('@/views/goods/params.vue') },
      { path: '/goods', component: () => import('@/views/goods/goods.vue') },
      // { path: '/goods/add', component: () => import('@/views/login/index.vue') },
      { path: '/orders', component: () => import('@/views/order/index.vue') },
      { path: '/reports', component: () => import('@/views/census/index.vue') }
    ]
  },
  {
    path: '*',
    component: () => import('@/views/404.vue')
  }
]

const router = new VueRouter({
  routes
})
export default router
